import { IFeidaoAiWeappPage } from '@dfeidao/atom-wxapp/interfaces';
// import set_global from '@dfeidao/atom-wxapp/global/set';
import get_local from '@dfeidao/atom-wxapp/local/get';
// import set_local from '@dfeidao/atom-wxapp/local/set';
import render from '@dfeidao/atom-wxapp/render/render';
import pause_video from '@dfeidao/atom-wxapp/api/media/pause-video';

export default async function a002(fd: IFeidaoAiWeappPage, e: {
	detail: {
		current: number;
	}
}) {
	const videoManage = get_local(fd, 'videoManage') as Array<{ index: number, manage: string }>;

	const current = e.detail.current;

	videoManage.filter((v) => {
		return v.index !== current;
	}).forEach((i) => {
		pause_video(i.manage);
	});

	render(fd, {
		current,
		play: '',
		autoplay: true,
		showDots: true
	});

}
